/*
*
* SPDX-License-Identifier: GPL-2.0
*
* Copyright (C) 2011-2018 ARM or its affiliates
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2.
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/

#if !defined(__IMX307_SENSOR_H__)
#define __IMX307_SENSOR_H__


/*-----------------------------------------------------------------------------
Initialization sequence - do not edit
-----------------------------------------------------------------------------*/

#include "sensor_init.h"

/* mclk:37.125MHz */

/*
 * bayer = BAYER_RGGB
 */
static acam_reg_t linear_1080p_30fps_223Mbps_4lane_12bits[] = {
    {0x3000, 0x01, 0xff, 1}, /* standby */
    {0xFFFF, 1},

    {0x3005, 0x01, 0xff, 1}, //0:10bit 1:12bit
    {0x3007, 0x00, 0xff, 1}, //full hd 1080p
    {0x3009, 0x02, 0xff, 1},
    {0x300a, 0xF0, 0xff, 1}, //black level
    {0x300b, 0x00, 0xff, 1},
    {0x300c, 0x00, 0xff, 1},
    {0x300f, 0x00, 0xff, 1},
    {0x3011, 0x0a, 0xff, 1},
    {0x3014, 0x00, 0xff, 1},//Gain
    {0x3018, 0x65, 0xff, 1}, /* VMAX[7:0] */
    {0x3019, 0x04, 0xff, 1}, /* VMAX[15:8] */
    {0x301a, 0x00, 0xff, 1}, /* VMAX[16] */
    {0x301b, 0x00, 0xff, 1},
    {0x301c, 0x30, 0xff, 1}, /* HMAX[7:0] */
    {0x301d, 0x11, 0xff, 1}, /* HMAX[15:8] */
    {0x3020, 0x01, 0xff, 1},//SHS1
    {0x3021, 0x00, 0xff, 1},//SHS1
    {0x3022, 0x00, 0xff, 1},//SHS1
    {0x3024, 0x00, 0xff, 1},//SHS2
    {0x3025, 0x00, 0xff, 1},//SHS2
    {0x3026, 0x00, 0xff, 1},//SHS2
    {0x3030, 0x00, 0xff, 1},//RHS1
    {0x3031, 0x00, 0xff, 1},//RHS1
    {0x3032, 0x00, 0xff, 1},//RHS1
    {0x3045, 0x01, 0xff, 1},//DOL
    {0x3046, 0x01, 0xff, 1},//LANE CHN
    {0x304b, 0x0a, 0xff, 1},

    {0x305c, 0x18, 0xff, 1},
    {0x305d, 0x03, 0xff, 1},
    {0x305e, 0x20, 0xff, 1},
    {0x305f, 0x01, 0xff, 1},
    {0x309e, 0x4a, 0xff, 1},
    {0x309f, 0x4a, 0xff, 1},

    {0x3106, 0x00, 0xff, 1}, //Need double confirm, H company 11h, 8/3th version
    {0x311c, 0x0e, 0xff, 1},
    {0x3128, 0x04, 0xff, 1},
    {0x3129, 0x00, 0xff, 1},

    {0x313b, 0x41, 0xff, 1},
    {0x315e, 0x1a, 0xff, 1},// 1A:37.125MHz 1B:74.25MHz
    {0x3164, 0x1a, 0xff, 1},// 1A:37.125MHz 1B:74.25MHz
    {0x317c, 0x00, 0xff, 1},
    {0x31ec, 0x0e, 0xff, 1},

    {0x3405, 0x20, 0xff, 1},
    {0x3407, 0x03, 0xff, 1},
    {0x3414, 0x0a, 0xff, 1},
    {0x3415, 0x01, 0xff, 1},
    {0x3418, 0x49, 0xff, 1},
    {0x3419, 0x04, 0xff, 1},
    {0x3441, 0x0c, 0xff, 1},
    {0x3442, 0x0c, 0xff, 1},
    {0x3443, 0x03, 0xff, 1},
    {0x3444, 0x20, 0xff, 1},//mclk :37.125M
    {0x3445, 0x25, 0xff, 1},
    {0x3446, 0x47, 0xff, 1},//global timming
    {0x3447, 0x00, 0xff, 1},
    {0x3448, 0x1f, 0xff, 1},
    {0x3449, 0x00, 0xff, 1},
    {0x344a, 0x17, 0xff, 1},
    {0x344b, 0x00, 0xff, 1},
    {0x344c, 0x0f, 0xff, 1},
    {0x344d, 0x00, 0xff, 1},
    {0x344e, 0x17, 0xff, 1},
    {0x344f, 0x00, 0xff, 1},
    {0x3450, 0x47, 0xff, 1},
    {0x3451, 0x00, 0xff, 1},
    {0x3452, 0x0f, 0xff, 1},
    {0x3453, 0x00, 0xff, 1},
    {0x3454, 0x0f, 0xff, 1},
    {0x3455, 0x00, 0xff, 1},

    {0x3472, 0x9c, 0xff, 1},
    {0x3473, 0x07, 0xff, 1},
    {0x347b, 0x24, 0xff, 1},//add
    {0x3480, 0x49, 0xff, 1},

    {0xFFFF, 1},
    {0x3002, 0x00, 0xff, 1}, /* master mode start */
    {0xFFFF, 1},
    {0x3049, 0x0A, 0xff, 1}, /* XVSOUTSEL XHSOUTSEL */
    {0x0000, 0x0000, 0x0000, 0x0000},
};

static acam_reg_t linear_1080p_60fps_2lane_10bits[] = {
    {0x3000, 0x01, 0xff, 1}, /* standby */
    {0xFFFF, 1},

    {0x3005, 0x01, 0xff, 1}, //0:10bit 1:12bit
    {0x3007, 0x00, 0xff, 1}, //full hd 1080p
    {0x3009, 0x02, 0xff, 1},
    {0x300a, 0xF0, 0xff, 1}, //black level
    {0x300b, 0x00, 0xff, 1},
    {0x300c, 0x00, 0xff, 1},
    {0x300f, 0x00, 0xff, 1},
    {0x3011, 0x0a, 0xff, 1},
    {0x3014, 0x00, 0xff, 1},//Gain
    {0x3018, 0x65, 0xff, 1}, /* VMAX[7:0] */
    {0x3019, 0x04, 0xff, 1}, /* VMAX[15:8] */
    {0x301a, 0x00, 0xff, 1}, /* VMAX[16] */
    {0x301b, 0x00, 0xff, 1},
    {0x301c, 0x30, 0xff, 1}, /* HMAX[7:0] */
    {0x301d, 0x11, 0xff, 1}, /* HMAX[15:8] */
    {0x3020, 0x01, 0xff, 1},//SHS1
    {0x3021, 0x00, 0xff, 1},//SHS1
    {0x3022, 0x00, 0xff, 1},//SHS1
    {0x3024, 0x00, 0xff, 1},//SHS2
    {0x3025, 0x00, 0xff, 1},//SHS2
    {0x3026, 0x00, 0xff, 1},//SHS2
    {0x3030, 0x00, 0xff, 1},//RHS1
    {0x3031, 0x00, 0xff, 1},//RHS1
    {0x3032, 0x00, 0xff, 1},//RHS1
    {0x3045, 0x01, 0xff, 1},//DOL
    {0x3046, 0x01, 0xff, 1},//LANE CHN
    {0x304b, 0x0a, 0xff, 1},

    {0x305c, 0x18, 0xff, 1},
    {0x305d, 0x03, 0xff, 1},
    {0x305e, 0x20, 0xff, 1},
    {0x305f, 0x01, 0xff, 1},
    {0x309e, 0x4a, 0xff, 1},
    {0x309f, 0x4a, 0xff, 1},

    {0x3106, 0x00, 0xff, 1}, //Need double confirm, H company 11h, 8/3th version
    {0x311c, 0x0e, 0xff, 1},
    {0x3128, 0x04, 0xff, 1},
    {0x3129, 0x00, 0xff, 1},

    {0x313b, 0x41, 0xff, 1},
    {0x315e, 0x1a, 0xff, 1},// 1A:37.125MHz 1B:74.25MHz
    {0x3164, 0x1a, 0xff, 1},// 1A:37.125MHz 1B:74.25MHz
    {0x317c, 0x00, 0xff, 1},
    {0x31ec, 0x0e, 0xff, 1},

    {0x3405, 0x20, 0xff, 1},
    {0x3407, 0x01, 0xff, 1},
    {0x3414, 0x0a, 0xff, 1},
    {0x3415, 0x01, 0xff, 1},
    {0x3418, 0x49, 0xff, 1},
    {0x3419, 0x04, 0xff, 1},
    {0x3441, 0x0c, 0xff, 1},
    {0x3442, 0x0c, 0xff, 1},
    {0x3443, 0x01, 0xff, 1},
    {0x3444, 0x20, 0xff, 1},//mclk :37.125M
    {0x3445, 0x25, 0xff, 1},
    {0x3446, 0x47, 0xff, 1},//global timming
    {0x3447, 0x00, 0xff, 1},
    {0x3448, 0x1f, 0xff, 1},
    {0x3449, 0x00, 0xff, 1},
    {0x344a, 0x17, 0xff, 1},
    {0x344b, 0x00, 0xff, 1},
    {0x344c, 0x0f, 0xff, 1},
    {0x344d, 0x00, 0xff, 1},
    {0x344e, 0x17, 0xff, 1},
    {0x344f, 0x00, 0xff, 1},
    {0x3450, 0x47, 0xff, 1},
    {0x3451, 0x00, 0xff, 1},
    {0x3452, 0x0f, 0xff, 1},
    {0x3453, 0x00, 0xff, 1},
    {0x3454, 0x0f, 0xff, 1},
    {0x3455, 0x00, 0xff, 1},

    {0x3472, 0x9c, 0xff, 1},
    {0x3473, 0x07, 0xff, 1},
    {0x347b, 0x24, 0xff, 1},//add
    {0x3480, 0x49, 0xff, 1},

    {0xFFFF, 1},
    {0x3002, 0x00, 0xff, 1}, /* master mode start */
    {0xFFFF, 1},
    {0x3049, 0x0A, 0xff, 1}, /* XVSOUTSEL XHSOUTSEL */
    {0x0000, 0x0000, 0x0000, 0x0000},
};


static acam_reg_t linear_1080p_60fps_446Mbps_4lane_12bits[] = {
    //{0x3003, 0x01, 0xff, 1}, /* sw_reset */
    //{0xFFFF, 200},
    {0x3000, 0x01, 0xff, 1}, /* standby */
    {0x3002, 0x00, 0xff, 1}, /* XTMSTA */

    {0x3005, 0x01, 0xff, 1},
    {0x3007, 0x00, 0xff, 1},
    {0x3009, 0x01, 0xff, 1},
    {0x300a, 0xf0, 0xff, 1},
    {0x300b, 0x00, 0xff, 1},
    {0x300c, 0x00, 0xff, 1},
    {0x3011, 0x0a, 0xff, 1},
    {0x3018, 0x65, 0xff, 1},//VMAX
    {0x3019, 0x04, 0xff, 1},//VMAX

    {0x301c, 0x98, 0xff, 1},//* HMAX
    {0x301d, 0x08, 0xff, 1},//* HMAX

    {0x3046, 0x01, 0xff, 1},//Datasheet should modify, Tools should modify
    {0x304b, 0x0a, 0xff, 1},

    {0x305c, 0x18, 0xff, 1},
    {0x305d, 0x03, 0xff, 1},
    {0x305e, 0x20, 0xff, 1},
    {0x305f, 0x01, 0xff, 1},

    {0x309e, 0x4a, 0xff, 1},
    {0x309f, 0x4a, 0xff, 1},

    {0x3106, 0x00, 0xff, 1}, //Need double confirm, H company 11h
    {0x311c, 0x0e, 0xff, 1},
    {0x3128, 0x04, 0xff, 1},
    {0x3129, 0x00, 0xff, 1},

    {0x313b, 0x41, 0xff, 1},
    {0x315e, 0x1a, 0xff, 1},// 1A:37.125MHz 1B:74.25MHz
    {0x3164, 0x1a, 0xff, 1},// 1A:37.125MHz 1B:74.25MHz
    {0x317c, 0x00, 0xff, 1},
    {0x31ec, 0x0e, 0xff, 1},

    {0x3405, 0x10, 0xff, 1},
    {0x3407, 0x03, 0xff, 1},
    {0x3414, 0x0a, 0xff, 1},
    {0x3415, 0x01, 0xff, 1},
    {0x3418, 0x49, 0xff, 1},
    {0x3419, 0x04, 0xff, 1},
    {0x3441, 0x0c, 0xff, 1},
    {0x3442, 0x0c, 0xff, 1},
    {0x3443, 0x03, 0xff, 1},
    {0x3444, 0x20, 0xff, 1},//mclk :37.125M
    {0x3445, 0x25, 0xff, 1},
    {0x3446, 0x57, 0xff, 1},//global timming
    {0x3447, 0x00, 0xff, 1},
    {0x3448, 0x37, 0xff, 1},
    {0x3449, 0x00, 0xff, 1},
    {0x344a, 0x1f, 0xff, 1},
    {0x344b, 0x00, 0xff, 1},
    {0x344c, 0x1f, 0xff, 1},
    {0x344d, 0x00, 0xff, 1},
    {0x344e, 0x1f, 0xff, 1},
    {0x344f, 0x00, 0xff, 1},
    {0x3450, 0x77, 0xff, 1},
    {0x3451, 0x00, 0xff, 1},
    {0x3452, 0x1f, 0xff, 1},
    {0x3453, 0x00, 0xff, 1},
    {0x3454, 0x17, 0xff, 1},
    {0x3455, 0x00, 0xff, 1},

    {0x3472, 0x9c, 0xff, 1},
    {0x3473, 0x07, 0xff, 1},
    {0x3480, 0x49, 0xff, 1},

    {0xFFFF, 1},
    {0x3002, 0x00, 0xff, 1}, /* master mode start */
    {0x0000, 0x0000, 0x0000, 0x0000}
};

static acam_reg_t linear_720p_30fps_149Mbps_4lane_12bits[] = {
    //{0x3003, 0x01, 0xff, 1}, /* sw_reset */
    //{0xFFFF, 200},
    {0x3000, 0x01, 0xff, 1}, /* standby */
    {0x3002, 0x00, 0xff, 1}, /* XTMSTA */

    {0x3005, 0x01, 0xff, 1},
    {0x3007, 0x10, 0xff, 1},
    {0x3009, 0x02, 0xff, 1},
    {0x300a, 0xf0, 0xff, 1},
    {0x300b, 0x00, 0xff, 1},
    {0x300c, 0x00, 0xff, 1},
    {0x3011, 0x0a, 0xff, 1},
    {0x3018, 0xee, 0xff, 1},//VMAX
    {0x3019, 0x02, 0xff, 1},//VMAX

    {0x301c, 0xc8, 0xff, 1},//* HMAX
    {0x301d, 0x19, 0xff, 1},//* HMAX

    {0x3046, 0x01, 0xff, 1},//Datasheet should modify, Tools should modify
    {0x304b, 0x0a, 0xff, 1},

    {0x305c, 0x20, 0xff, 1},
    {0x305d, 0x00, 0xff, 1},
    {0x305e, 0x20, 0xff, 1},
    {0x305f, 0x01, 0xff, 1},

    {0x309e, 0x4a, 0xff, 1},
    {0x309f, 0x4a, 0xff, 1},

    {0x3106, 0x00, 0xff, 1}, //Need double confirm, H company 11h, 8/3th version
    {0x311c, 0x0e, 0xff, 1},
    {0x3128, 0x04, 0xff, 1},
    {0x3129, 0x00, 0xff, 1},

    {0x313b, 0x41, 0xff, 1},
    {0x315e, 0x1a, 0xff, 1},// 1A:37.125MHz 1B:74.25MHz
    {0x3164, 0x1a, 0xff, 1},// 1A:37.125MHz 1B:74.25MHz
    {0x317c, 0x00, 0xff, 1},
    {0x31ec, 0x0e, 0xff, 1},

    {0x3405, 0x20, 0xff, 1},
    {0x3407, 0x03, 0xff, 1},
    {0x3414, 0x04, 0xff, 1},
    {0x3415, 0x01, 0xff, 1},
    {0x3418, 0xd9, 0xff, 1},
    {0x3419, 0x02, 0xff, 1},
    {0x3441, 0x0c, 0xff, 1},
    {0x3442, 0x0c, 0xff, 1},
    {0x3443, 0x03, 0xff, 1},
    {0x3444, 0x20, 0xff, 1},//mclk :37.125M
    {0x3445, 0x25, 0xff, 1},

    {0x3446, 0x47, 0xff, 1},//global timming
    {0x3447, 0x00, 0xff, 1},
    {0x3448, 0x17, 0xff, 1},
    {0x3449, 0x00, 0xff, 1},
    {0x344a, 0x0f, 0xff, 1},
    {0x344b, 0x00, 0xff, 1},
    {0x344c, 0x0f, 0xff, 1},
    {0x344d, 0x00, 0xff, 1},
    {0x344e, 0x0f, 0xff, 1},
    {0x344f, 0x00, 0xff, 1},
    {0x3450, 0x2b, 0xff, 1},
    {0x3451, 0x00, 0xff, 1},
    {0x3452, 0x0b, 0xff, 1},
    {0x3453, 0x00, 0xff, 1},
    {0x3454, 0x0f, 0xff, 1},
    {0x3455, 0x00, 0xff, 1},

    {0x3472, 0x1c, 0xff, 1},
    {0x3473, 0x05, 0xff, 1},
    {0x3480, 0x49, 0xff, 1},

    {0xFFFF, 1},
    {0x3002, 0x00, 0xff, 1}, /* master mode start */
    {0x0000, 0x0000, 0x0000, 0x0000},
};

static acam_reg_t linear_720p_60fps_297Mbps_4lane_12bits[] = {
    //{0x3003, 0x01, 0xff, 1}, /* sw_reset */
    //{0xFFFF, 200},
    {0x3000, 0x01, 0xff, 1}, /* standby */
    {0x3002, 0x00, 0xff, 1}, /* XTMSTA */

    {0x3005, 0x01, 0xff, 1},
    {0x3007, 0x10, 0xff, 1},
    {0x3009, 0x01, 0xff, 1},
    {0x300a, 0xf0, 0xff, 1},
    {0x300b, 0x00, 0xff, 1},
    {0x300c, 0x00, 0xff, 1},
    {0x3011, 0x0a, 0xff, 1},
    {0x3018, 0xee, 0xff, 1},//VMAX
    {0x3019, 0x02, 0xff, 1},//VMAX

    {0x301c, 0xe4, 0xff, 1},//* HMAX
    {0x301d, 0x0c, 0xff, 1},//* HMAX

    {0x3046, 0x01, 0xff, 1},//Datasheet should modify, Tools should modify
    {0x304b, 0x0a, 0xff, 1},

    {0x305c, 0x20, 0xff, 1},
    {0x305d, 0x00, 0xff, 1},
    {0x305e, 0x20, 0xff, 1},
    {0x305f, 0x01, 0xff, 1},

    {0x309e, 0x4a, 0xff, 1},
    {0x309f, 0x4a, 0xff, 1},

    {0x3106, 0x00, 0xff, 1}, //Need double confirm, H company 11h, 8/3th version
    {0x311c, 0x0e, 0xff, 1},
    {0x3128, 0x04, 0xff, 1},
    {0x3129, 0x00, 0xff, 1},

    {0x313b, 0x41, 0xff, 1},
    {0x315e, 0x1a, 0xff, 1},// 1A:37.125MHz 1B:74.25MHz
    {0x3164, 0x1a, 0xff, 1},// 1A:37.125MHz 1B:74.25MHz
    {0x317c, 0x00, 0xff, 1},
    {0x31ec, 0x0e, 0xff, 1},

    {0x3405, 0x10, 0xff, 1},
    {0x3407, 0x03, 0xff, 1},
    {0x3414, 0x04, 0xff, 1},
    {0x3415, 0x01, 0xff, 1},
    {0x3418, 0xd9, 0xff, 1},
    {0x3419, 0x02, 0xff, 1},
    {0x3441, 0x0c, 0xff, 1},
    {0x3442, 0x0c, 0xff, 1},
    {0x3443, 0x03, 0xff, 1},
    {0x3444, 0x20, 0xff, 1},//mclk :37.125M
    {0x3445, 0x25, 0xff, 1},

    {0x3446, 0x4f, 0xff, 1},//global timming
    {0x3447, 0x00, 0xff, 1},
    {0x3448, 0x2f, 0xff, 1},
    {0x3449, 0x00, 0xff, 1},
    {0x344a, 0x17, 0xff, 1},
    {0x344b, 0x00, 0xff, 1},
    {0x344c, 0x17, 0xff, 1},
    {0x344d, 0x00, 0xff, 1},
    {0x344e, 0x17, 0xff, 1},
    {0x344f, 0x00, 0xff, 1},
    {0x3450, 0x57, 0xff, 1},
    {0x3451, 0x00, 0xff, 1},
    {0x3452, 0x17, 0xff, 1},
    {0x3453, 0x00, 0xff, 1},
    {0x3454, 0x17, 0xff, 1},
    {0x3455, 0x00, 0xff, 1},
    {0x3472, 0x1c, 0xff, 1},
    {0x3473, 0x05, 0xff, 1},
    {0x3480, 0x49, 0xff, 1},

    {0xFFFF, 1},
    {0x3002, 0x00, 0xff, 1}, /* master mode start */
    {0x0000, 0x0000, 0x0000, 0x0000},
};

static acam_reg_t dol_1080p_30fps_4lane_12bits[] = {
    //{0x3003, 0x01, 0xff, 1}, /* sw_reset */
    //{0xFFFF, 200},
    {0x3000, 0x01, 0xff, 1}, /* standby */
    {0xFFFF, 1},
    {0x3002, 0x00, 0xff, 1}, /* XTMSTA */

    {0x3005, 0x01, 0xff, 1},
    {0x3007, 0x00, 0xff, 1},
    {0x3009, 0x01, 0xff, 1},
    {0x300a, 0xF0, 0xff, 1},
    {0x300c, 0x11, 0xff, 1},
    {0x3011, 0x0a, 0xff, 1},
    {0x3018, 0x65, 0xff, 1},//VMAX change from 0465 to 04C4
    {0x3019, 0x04, 0xff, 1},//VMAX
    {0x301c, 0x98, 0xff, 1},//* HMAX */ change from 0898 to 07EC
    {0x301d, 0x08, 0xff, 1},//* HMAX */
    {0x3020, 0x02, 0xff, 1},//SHS1
    {0x3021, 0x00, 0xff, 1},//SHS1
    {0x3022, 0x00, 0xff, 1},//SHS1
    {0x3024, 0x49, 0xff, 1},//SHS2
    {0x3025, 0x08, 0xff, 1},//SHS2
    {0x3026, 0x00, 0xff, 1},//SHS2
    {0x3030, 0x0B, 0xff, 1},//RHS1
    {0x3031, 0x00, 0xff, 1},//RHS1
    {0x3032, 0x00, 0xff, 1},//RHS1
    {0x3045, 0x05, 0xff, 1},//DOL
    {0x3046, 0x01, 0xff, 1},//Datasheet should modify, Tools should modify
    {0x304b, 0x0a, 0xff, 1},
    {0x305c, 0x18, 0xff, 1},
    {0x305d, 0x03, 0xff, 1},
    {0x305e, 0x20, 0xff, 1},
    {0x305f, 0x01, 0xff, 1},
    {0x309e, 0x4a, 0xff, 1},
    {0x309f, 0x4a, 0xff, 1},
    {0x3106, 0x11, 0xff, 1}, //Need double confirm, H company 11h, 8/3th version
    {0x311c, 0x0e, 0xff, 1},
    {0x3128, 0x04, 0xff, 1},
    {0x3129, 0x00, 0xff, 1},
    {0x313b, 0x41, 0xff, 1},
    {0x315e, 0x1a, 0xff, 1},// 1A:37.125MHz 1B:74.25MHz
    {0x3164, 0x1a, 0xff, 1},// 1A:37.125MHz 1B:74.25MHz
    {0x317c, 0x00, 0xff, 1},
    {0x31a0, 0xFC, 0xff, 1},
    {0x31a1, 0x00, 0xff, 1},
    {0x31ec, 0x0E, 0xff, 1},
    {0x3405, 0x10, 0xff, 1},
    {0x3407, 0x03, 0xff, 1},
    {0x3414, 0x00, 0xff, 1},
    {0x3415, 0x00, 0xff, 1},
    {0x3418, 0xB4, 0xff, 1}, // Y_OUT_SIZE
    {0x3419, 0x08, 0xff, 1},
    {0x3441, 0x0c, 0xff, 1},
    {0x3442, 0x0c, 0xff, 1},
    {0x3443, 0x03, 0xff, 1},
    {0x3444, 0x20, 0xff, 1},//mclk :37.125M
    {0x3445, 0x25, 0xff, 1},
    {0x3446, 0x57, 0xff, 1},//global timming
    {0x3447, 0x00, 0xff, 1},
    {0x3448, 0x37, 0xff, 1},
    {0x3449, 0x00, 0xff, 1},
    {0x344a, 0x1f, 0xff, 1},
    {0x344b, 0x00, 0xff, 1},
    {0x344c, 0x1f, 0xff, 1},
    {0x344d, 0x00, 0xff, 1},
    {0x344e, 0x1f, 0xff, 1},
    {0x344f, 0x00, 0xff, 1},
    {0x3450, 0x77, 0xff, 1},
    {0x3451, 0x00, 0xff, 1},
    {0x3452, 0x1f, 0xff, 1},
    {0x3453, 0x00, 0xff, 1},
    {0x3454, 0x17, 0xff, 1},
    {0x3455, 0x00, 0xff, 1},
    {0x3472, 0xa0, 0xff, 1},
    {0x3473, 0x07, 0xff, 1},
    {0x347b, 0x23, 0xff, 1},//add
    {0x3480, 0x49, 0xff, 1},

    {0xFFFF, 1},
    {0x3002, 0x00, 0xff, 1}, /* master mode start */
    {0x0000, 0x0000, 0x0000, 0x0000},
};

static acam_reg_t dol_1080p_30fps_4lane_10bits[] = {
    //{0x3003, 0x01, 0xff, 1}, /* sw_reset */
    //{0xFFFF, 200},
    {0x3000, 0x01, 0xff, 1}, /* standby */
    {0xFFFF, 1},
    {0x3002, 0x00, 0xff, 1}, /* XTMSTA */

    {0x3005, 0x00, 0xff, 1},
    {0x3007, 0x00, 0xff, 1},
    {0x3009, 0x01, 0xff, 1},
    {0x300a, 0x3c, 0xff, 1},
    {0x300c, 0x11, 0xff, 1},
    {0x3011, 0x0a, 0xff, 1},
    {0x3018, 0xC4, 0xff, 1},//VMAX change from 0465 to 04C4
    {0x3019, 0x04, 0xff, 1},//VMAX

    {0x301c, 0xEC, 0xff, 1},//* HMAX */ change from 0898 to 07EC
    {0x301d, 0x07, 0xff, 1},//* HMAX */
    {0x3020, 0x3c, 0xff, 1},//SHS1
    {0x3021, 0x00, 0xff, 1},//SHS1
    {0x3022, 0x00, 0xff, 1},//SHS1
    {0x3024, 0xcb, 0xff, 1},//SHS2
    {0x3025, 0x00, 0xff, 1},//SHS2
    {0x3026, 0x00, 0xff, 1},//SHS2
    {0x3030, 0xc9, 0xff, 1},//RHS1
    {0x3031, 0x00, 0xff, 1},//RHS1
    {0x3032, 0x00, 0xff, 1},//RHS1

    {0x3045, 0x05, 0xff, 1},//DOL
    {0x3046, 0x00, 0xff, 1},//Datasheet should modify, Tools should modify
    {0x304b, 0x0a, 0xff, 1},
    {0x3418, 0x68, 0xff, 1},//Y_out size, tools should modify from 089c to 0968
    {0x3419, 0x09, 0xff, 1},//Y_out size

    {0x305c, 0x18, 0xff, 1},
    {0x305d, 0x03, 0xff, 1},
    {0x305e, 0x20, 0xff, 1},
    {0x305f, 0x01, 0xff, 1},

    {0x309e, 0x4a, 0xff, 1},
    {0x309f, 0x4a, 0xff, 1},

    {0x3106, 0x11, 0xff, 1}, //Need double confirm, H company 11h, 8/3th version
    {0x311c, 0x0e, 0xff, 1},
    {0x3128, 0x04, 0xff, 1},
    {0x3129, 0x1d, 0xff, 1},

    {0x313b, 0x41, 0xff, 1},
    {0x315e, 0x1a, 0xff, 1},// 1A:37.125MHz 1B:74.25MHz
    {0x3164, 0x1a, 0xff, 1},// 1A:37.125MHz 1B:74.25MHz
    {0x317c, 0x12, 0xff, 1},
    {0x31ec, 0x37, 0xff, 1},

    {0x3405, 0x10, 0xff, 1},
    {0x3407, 0x03, 0xff, 1},
    {0x3414, 0x0a, 0xff, 1},
    {0x3415, 0x00, 0xff, 1},
    {0x3441, 0x0a, 0xff, 1},
    {0x3442, 0x0a, 0xff, 1},
    {0x3443, 0x03, 0xff, 1},
    {0x3444, 0x20, 0xff, 1},//mclk :37.125M
    {0x3445, 0x25, 0xff, 1},

    {0x3446, 0x57, 0xff, 1},//global timming
    {0x3447, 0x00, 0xff, 1},
    {0x3448, 0x37, 0xff, 1},
    {0x3449, 0x00, 0xff, 1},
    {0x344a, 0x1f, 0xff, 1},
    {0x344b, 0x00, 0xff, 1},
    {0x344c, 0x1f, 0xff, 1},
    {0x344d, 0x00, 0xff, 1},
    {0x344e, 0x1f, 0xff, 1},
    {0x344f, 0x00, 0xff, 1},
    {0x3450, 0x77, 0xff, 1},
    {0x3451, 0x00, 0xff, 1},
    {0x3452, 0x1f, 0xff, 1},
    {0x3453, 0x00, 0xff, 1},
    {0x3454, 0x17, 0xff, 1},
    {0x3455, 0x00, 0xff, 1},
    {0x3472, 0xa0, 0xff, 1},
    {0x3473, 0x07, 0xff, 1},
    {0x347b, 0x23, 0xff, 1},//add
    {0x3480, 0x49, 0xff, 1},

    {0xFFFF, 1},
    {0x3002, 0x00, 0xff, 1}, /* master mode start */
    {0x0000, 0x0000, 0x0000, 0x0000},
};

static acam_reg_t dol_1080p_30fps_2lane_10bits[] = {
    //{0x3003, 0x01, 0xff, 1}, /* sw_reset */
    //{0xFFFF, 200},
    {0x3000, 0x01, 0xff, 1}, /* standby */
    {0xFFFF, 1},
    {0x3002, 0x00, 0xff, 1}, /* XTMSTA */

    {0x3005, 0x00, 0xff, 1},
    {0x3007, 0x00, 0xff, 1}, //FULLHD
    {0x3009, 0x02, 0xff, 1},
    {0x300a, 0x3c, 0xff, 1}, //BLACKLEVEL
    {0x300c, 0x11, 0xff, 1},
    {0x3011, 0x0a, 0xff, 1},
    {0x3018, 0x65, 0xff, 1},//VMAX change from 0465 to 04C4
    {0x3019, 0x04, 0xff, 1},//VMAX
	{0x301a, 0x00, 0xff, 1}, /* VMAX[16] */
	{0x301b, 0x00, 0xff, 1},
    {0x301c, 0x30, 0xff, 1},//* HMAX */ change from 0898 to 07EC
    {0x301d, 0x11, 0xff, 1},//* HMAX */ //30fps
    {0x3020, 0x3c, 0xff, 1},//SHS1
    {0x3021, 0x00, 0xff, 1},//SHS1
    {0x3022, 0x00, 0xff, 1},//SHS1
    {0x3024, 0xcb, 0xff, 1},//SHS2
    {0x3025, 0x00, 0xff, 1},//SHS2
    {0x3026, 0x00, 0xff, 1},//SHS2
    {0x3030, 0xc9, 0xff, 1},//RHS1
    {0x3031, 0x00, 0xff, 1},//RHS1
    {0x3032, 0x00, 0xff, 1},//RHS1

    {0x3045, 0x05, 0xff, 1},//DOL
    {0x3046, 0x00, 0xff, 1},//Datasheet should modify, Tools should modify  //0:10bit 1:12bit
    {0x304b, 0x0a, 0xff, 1},
    {0x3418, 0x68, 0xff, 1},//Y_out size, tools should modify from 089c to 0968
    {0x3419, 0x09, 0xff, 1},//Y_out size

    {0x305c, 0x18, 0xff, 1},
    {0x305d, 0x03, 0xff, 1},
    {0x305e, 0x20, 0xff, 1},
    {0x305f, 0x01, 0xff, 1},

    {0x309e, 0x4a, 0xff, 1},
    {0x309f, 0x4a, 0xff, 1},

    {0x3106, 0x11, 0xff, 1}, //Need double confirm, H company 11h, 8/3th version
    {0x311c, 0x0e, 0xff, 1},
    {0x3128, 0x04, 0xff, 1},
    {0x3129, 0x1d, 0xff, 1},

    {0x313b, 0x41, 0xff, 1},
    {0x315e, 0x1a, 0xff, 1},// 1A:37.125MHz 1B:74.25MHz
    {0x3164, 0x1a, 0xff, 1},// 1A:37.125MHz 1B:74.25MHz
    {0x317c, 0x12, 0xff, 1},
    {0x31ec, 0x37, 0xff, 1},

    {0x3405, 0x11, 0xff, 1},
    {0x3407, 0x01, 0xff, 1},
    {0x3414, 0x0a, 0xff, 1},
    {0x3415, 0x00, 0xff, 1},
    {0x3441, 0x0a, 0xff, 1},
    {0x3442, 0x0a, 0xff, 1},
    {0x3443, 0x01, 0xff, 1},
    {0x3444, 0x20, 0xff, 1},//mclk :37.125M
    {0x3445, 0x25, 0xff, 1},

    {0x3446, 0x57, 0xff, 1},//global timming
    {0x3447, 0x00, 0xff, 1},
    {0x3448, 0x37, 0xff, 1},
    {0x3449, 0x00, 0xff, 1},
    {0x344a, 0x1f, 0xff, 1},
    {0x344b, 0x00, 0xff, 1},
    {0x344c, 0x1f, 0xff, 1},
    {0x344d, 0x00, 0xff, 1},
    {0x344e, 0x1f, 0xff, 1},
    {0x344f, 0x00, 0xff, 1},
    {0x3450, 0x77, 0xff, 1},
    {0x3451, 0x00, 0xff, 1},
    {0x3452, 0x1f, 0xff, 1},
    {0x3453, 0x00, 0xff, 1},
    {0x3454, 0x17, 0xff, 1},
    {0x3455, 0x00, 0xff, 1},
    {0x3472, 0xa0, 0xff, 1},
    {0x3473, 0x07, 0xff, 1},
    {0x347b, 0x23, 0xff, 1},//add
    {0x3480, 0x49, 0xff, 1},

    {0xFFFF, 1},
    {0x3002, 0x00, 0xff, 1}, /* master mode start */
    {0x0000, 0x0000, 0x0000, 0x0000},
};

static acam_reg_t dol_720p_30fps_4lane_10bits[] = {
    //{0x3003, 0x01, 0xff, 1}, /* sw_reset */
    //{0xFFFF, 200},
    {0x3000, 0x01, 0xff, 1}, /* standby */
    {0xFFFF, 1},
    {0x3002, 0x00, 0xff, 1}, /* XTMSTA */

    {0x3005, 0x00, 0xff, 1},
    {0x3007, 0x10, 0xff, 1},
    {0x3009, 0x01, 0xff, 1},
    {0x300a, 0x3c, 0xff, 1},
    {0x300c, 0x11, 0xff, 1},
    {0x3011, 0x0a, 0xff, 1},
    {0x3018, 0xee, 0xff, 1},//VMAX
    {0x3019, 0x02, 0xff, 1},//VMAX

    {0x301c, 0xe4, 0xff, 1},//* HMAX
    {0x301d, 0x0c, 0xff, 1},//* HMAX
    {0x3020, 0x02, 0xff, 1},//SHS1
    {0x3021, 0x00, 0xff, 1},//SHS1
    {0x3022, 0x00, 0xff, 1},//SHS1
    {0x3024, 0x7b, 0xff, 1},//SHS2
    {0x3025, 0x05, 0xff, 1},//SHS2
    {0x3026, 0x00, 0xff, 1},//SHS2
    {0x3030, 0x09, 0xff, 1},//RHS1
    {0x3031, 0x00, 0xff, 1},//RHS1
    {0x3032, 0x00, 0xff, 1},//RHS1

    {0x3045, 0x05, 0xff, 1},//DOL
    {0x3046, 0x00, 0xff, 1},//Datasheet should modify, Tools should modify
    {0x304b, 0x0a, 0xff, 1},

    {0x305c, 0x20, 0xff, 1},
    {0x305d, 0x00, 0xff, 1},
    {0x305e, 0x20, 0xff, 1},
    {0x305f, 0x01, 0xff, 1},

    {0x309e, 0x4a, 0xff, 1},
    {0x309f, 0x4a, 0xff, 1},

    {0x3106, 0x11, 0xff, 1}, //Need double confirm, H company 11h, 8/3th version
    {0x311c, 0x0e, 0xff, 1},
    {0x3128, 0x04, 0xff, 1},
    {0x3129, 0x1d, 0xff, 1},

    {0x313b, 0x41, 0xff, 1},
    {0x315e, 0x1a, 0xff, 1},// 1A:37.125MHz 1B:74.25MHz
    {0x3164, 0x1a, 0xff, 1},// 1A:37.125MHz 1B:74.25MHz
    {0x317c, 0x12, 0xff, 1},
    {0x31ec, 0x37, 0xff, 1},

    {0x3405, 0x10, 0xff, 1},
    {0x3407, 0x03, 0xff, 1},
    {0x3414, 0x04, 0xff, 1},
    {0x3415, 0x00, 0xff, 1},
    {0x3418, 0xba, 0xff, 1},
    {0x3419, 0x05, 0xff, 1},
    {0x3441, 0x0a, 0xff, 1},
    {0x3442, 0x0a, 0xff, 1},
    {0x3443, 0x03, 0xff, 1},
    {0x3444, 0x20, 0xff, 1},//mclk :37.125M
    {0x3445, 0x25, 0xff, 1},

    {0x3446, 0x4f, 0xff, 1},//global timming
    {0x3447, 0x00, 0xff, 1},
    {0x3448, 0x2f, 0xff, 1},
    {0x3449, 0x00, 0xff, 1},
    {0x344a, 0x17, 0xff, 1},
    {0x344b, 0x00, 0xff, 1},
    {0x344c, 0x17, 0xff, 1},
    {0x344d, 0x00, 0xff, 1},
    {0x344e, 0x17, 0xff, 1},
    {0x344f, 0x00, 0xff, 1},
    {0x3450, 0x57, 0xff, 1},
    {0x3451, 0x00, 0xff, 1},
    {0x3452, 0x17, 0xff, 1},
    {0x3453, 0x00, 0xff, 1},
    {0x3454, 0x17, 0xff, 1},
    {0x3455, 0x00, 0xff, 1},

    {0x3472, 0x20, 0xff, 1},
    {0x3473, 0x05, 0xff, 1},
    {0x347b, 0x23, 0xff, 1},//add
    {0x3480, 0x49, 0xff, 1},

    {0xFFFF, 1},
    {0x3002, 0x00, 0xff, 1}, /* master mode start */
    {0x0000, 0x0000, 0x0000, 0x0000},
};

static acam_reg_t imx307_test_pattern[] = {
    {0x3000, 0x01, 0xff, 1}, /* standby */
    {0x300a, 0x00, 0xff, 1},
    {0x300e, 0x00, 0xff, 1},
    {0x300f, 0x00, 0xff, 1},
    {0x308c, 0x21, 0xff, 1},
    {0x0000, 0x0000, 0x0000, 0x0000},
};

static acam_reg_t settings_context_imx307[] = {
    //stop sequence - address is 0x0000
    { 0x1aeb4, 0x1edcL, 0x1fff,2 },
    { 0x1aeb8, 0x1edcL, 0x1fff,2 },
    { 0x1aec0, 0x808d2L, 0xffffff,4 },
    { 0x1aed0, 0xc8L, 0xff0fff,4 },
    { 0x1aee0, 0xc8L, 0xff0fff,4 },
    { 0x1c084, 0xc8L, 0xff03ff,4 }, //fr sharpen: Luma Offset Low; Luma Thresh Low
    { 0x1c090, 0x08c008cL, 0x3fff3fff,4 }, //fr sharpen: Clip Str Max; Clip Str Min
    { 0x1ac4c, 0xa9cd0501L, 0xffff0f01,4 }, //iridix: filter_mux; svariance; bright_pr; contrast
    { 0x0000, 0x0000, 0x0000, 0x0000 }
};

static const acam_reg_t *imx307_seq_table[] = {
    linear_1080p_30fps_223Mbps_4lane_12bits,
    linear_1080p_60fps_446Mbps_4lane_12bits,
    linear_720p_30fps_149Mbps_4lane_12bits,
    linear_720p_60fps_297Mbps_4lane_12bits,
    dol_1080p_30fps_4lane_12bits,
    dol_1080p_30fps_4lane_10bits,
    dol_720p_30fps_4lane_10bits,
    imx307_test_pattern,
    linear_1080p_60fps_2lane_10bits,
    dol_1080p_30fps_2lane_10bits,
};

static const acam_reg_t *isp_seq_table[] = {
    settings_context_imx307,
};

#define SENSOR_IMX307_SEQUENCE_1080P_30FPS_12BIT_4LANE        0
#define SENSOR_IMX307_SEQUENCE_1080P_60FPS_12BIT_4LANE        1
#define SENSOR_IMX307_SEQUENCE_720P_30FPS_12BIT_4LANE         2
#define SENSOR_IMX307_SEQUENCE_720P_60FPS_12BIT_4LANE         3
#define SENSOR_IMX307_SEQUENCE_1080P_30FPS_12BIT_4LANE_WDR    4
#define SENSOR_IMX307_SEQUENCE_1080P_30FPS_10BIT_4LANE_WDR    5
#define SENSOR_IMX307_SEQUENCE_720P_30FPS_10BIT_4LANE_WDR     6
#define SENSOR_IMX307_SEQUENCE_DEFAULT_TEST_PATTERN           7
#define SENSOR_IMX307_SEQUENCE_1080P_60FPS_10BIT_2LANE 		  8
#define SENSOR_IMX307_SEQUENCE_1080P_30FPS_10BIT_2LANE 		  9

#define SENSOR_IMX307_ISP_CONTEXT_SEQ 0
#endif /* __IMX307_SENSOR_H__ */
